<template>
	<view class="template-advertise">
		<!-- 顶部自定义导航 -->
		<tn-nav-bar fixed :isBack="true">
			{{title}}
		</tn-nav-bar>


		<view class="adver-wrap tn-bg-white" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
			<!-- <button @click="join_room()">加入房间</button>
			<button @click="out_room()">离开房间</button>
			<button @click="fasong()">发送内容</button>
			<button @click="liwu()">模拟直播送礼物</button>
			<button @click="liwuvod()">模拟1v1送礼物</button> -->

			<view class="tn-flex tn-flex-row-between tn-padding-top-lg">
				<view class="tn-padding">
					<view class="tn-text-bold tn-text-xl tn-padding-top-sm">
						{{title}}
					</view>
				</view>

			</view>

			<view class="detail-img tn-padding">
				<mp-html :content="body" />
			</view>

		</view>



	</view>
</template>

<script>
	import {
		host,
		webSocket,
		secretkey,
		sdkappid
	} from '@/siteinfo.js'
	import template_page_mixin from '@/libs/mixin/template_page_mixin.js'
	export default {
		name: 'templateAdvertise',
		mixins: [template_page_mixin],
		data() {
			return {
				title: '',
				id: 0,
				body: '',
				type: 'pages',
			}
		},
		onLoad(option) {

			if (option.id) {
				this.id = option.id
			}
			if (option.type) {
				this.type = option.type
			}
			if (option.title) {
				this.title = option.title
			}

			this.info()

		},

		methods: {
		

			info111() {
				let headerObj = {};
				if (uni.getStorageSync('token')) {
					headerObj.token = this.globalToken
				}
				uni.request({
					url: host + '/chat/vodlive/info',
					method: 'POST',
					data: {
						room_id: 9,
					},
					header: {
						...headerObj,
					},
					success: (res) => {
						console.log(res.data.data.zhuboinfo)
						//this.zhuboinfo=res.data.data.zhuboinfo					
						//this.roomInfo=res.data.data.roomInfo

					}
				})

			},
			out_room() {
				uni.sendSocketMessage({
					data: JSON.stringify({
						type: 'out_room',
						room_id:8,
						fromname: '张三',
						chaoguan: 0,
						vip: 1,
						zuojia: '',
						zuojianame: '',
						lv: 16,
						fromid: 2325,
						headimg: 'https://duoke-1259386034.cos.ap-nanjing.myqcloud.com/uploads/20250305/9e7f7ed7dda1ec5e297d251d8b268b9f.jpg',
						data: '离开房间了',
					})
				});
			},
			join_room() {
				uni.sendSocketMessage({
					data: JSON.stringify({
						type: 'join_room',
						room_id: 8,
						fromname: '张三',
						chaoguan: 0,
						vip: 1,
						zuojia: '',
						zuojianame: '',
						lv: 16,
						fromid: 2325,
						headimg: 'https://duoke-1259386034.cos.ap-nanjing.myqcloud.com/uploads/20250305/9e7f7ed7dda1ec5e297d251d8b268b9f.jpg',
						data: '进入房间了',
					})
				});
			},

			fasong() {
				var message =
					'{"data":"主播很帅啊啊啊","fromname":"张三","fromhead":"","sec":"0","lv":"6","type":"text","fromid":"2325","chaoguan":"1","vip":"1","room_id":"8"}';
				this.$socket.send(message);
			},


			liwu() {
				uni.sendSocketMessage({
					data: JSON.stringify({
						type: "roomqita",
						room_id:8,
						lei: "liwu",
						sec: 1,
						image:'https://duoke-1259386034.cos.ap-nanjing.myqcloud.com/uploads/20221231/d3ade91927b89f881771046a024cf8d7.png',
						vip: 1,
						svga:'',
						lv: 1,
						fromid: 1,
						fromhead:'',
						fromname:'张三'
					})
				});
			},
			
			
			
			
			
			xiugai(){
			
					let headerObj = {};
					if (uni.getStorageSync('token')) {
						headerObj.token = this.globalToken
					}
				
					uni.request({
						url: host + '/chat/vodlive/edit_title',
						method: 'POST',
						data: {
							user_id:uni.getStorageSync('user_id'),
							room_id:9,
							title:2222222
						},
						header: {
							...headerObj,
						},
						success: (res) => {
									console.log(res)			
						}
					})
				
				
				
			},
			
			async info() {
				let that = this;
				let result = await that.$request({
					loading: 1,
					method: 'post',
					url: '/chat/index/page',
					data: {
						id: that.id,
						type: that.type,
						title: that.title
					}
				});


				if (result.statusCode == 200) {
					if (result.data.code == 200) {
						that.title = result.data.data.title
						that.body = result.data.data.detail;
					} else {
						uni.showToast({
							icon: 'none',
							title: result.data.msg
						});
					}
				} else {
					uni.showToast({
						icon: 'none',
						title: that.$errorMsg
					});
				}


			},


		}
	}
</script>

<style lang="scss" scoped>
	@keyframes gradientBG {
		0% {
			background-position: 0% 50%;
		}

		50% {
			background-position: 100% 50%;
		}

		100% {
			background-position: 0% 50%;
		}
	}

	/* 内容 */
	.adver-wrap {
		position: relative;
		z-index: 1;
		border-radius: 80rpx 80rpx 0 0;
	}


	.dd-glass {
		width: 100%;
		backdrop-filter: blur(20rpx);
		-webkit-backdrop-filter: blur(20rpx);
	}




	.banner {
		position: fixed;
		top: 0;
		width: 100%;
		transition: all 0.25s ease-out;
		z-index: -1;
	}
</style>